<%--
    Document   : index
    Created on : Aug 6, 2010, 5:37:33 PM
    Author     : nguyenquang
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

    <c:if test="${empty param.ddllanguage}">
        <fmt:setLocale value="en_US" />
    </c:if>
    <c:if test="${not empty param.ddllanguage}">
        <fmt:setLocale value="${param.ddllanguage}" />
    </c:if>
    <fmt:setBundle basename="myweb.language" />
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title><fmt:message key="title" /></title>
        <script language="javascript" type="text/javascript">
            function changeLang(){
                document.frm.submit();
            }
        </script>
    </head>
    <body>
        <form name="frm" method="post" action="index.jsp">
            <table align="center">
                <tr>
                    <td><fmt:message key="selectlanguage" /></td>
                    <td>
                        <select name="ddllanguage" onchange="changeLang()">
                            <c:if test="${param.ddllanguage=='en_US'}">
                                <option value="en_US" selected><fmt:message key="en" /></option>
                            </c:if>
                            <c:if test="${param.ddllanguage!='en_US'}">
                                <option value="en_US" ><fmt:message key="en" /></option>
                            </c:if>

                            <c:if test="${param.ddllanguage=='fr_FR'}">
                                <option value="fr_FR" selected><fmt:message key="fr" /></option>
                            </c:if>
                            <c:if test="${param.ddllanguage!='fr_FR'}">
                                <option value="fr_FR" ><fmt:message key="fr" /></option>
                            </c:if>

                            <c:if test="${param.ddllanguage=='ja_JP'}">
                                <option value="ja_JP" selected><fmt:message key="ja" /></option>
                            </c:if>
                            <c:if test="${param.ddllanguage!='ja_JP'}">
                                <option value="ja_JP" ><fmt:message key="ja" /></option>
                            </c:if>
                        </select>
                     </td>
                </tr>
                <c:set var="date" value="<%=new java.util.Date()%>"/>
                <tr>
                    <td><fmt:message key="dateformat" /></td>
                    <td><fmt:formatDate value="${date}" dateStyle="full" type="both" /></td>
                </tr>
                <tr>
                    <td><fmt:message key="formatnumber" /></td>
                    <td><fmt:formatNumber type="number" value="123456" /></td>
                </tr>
                <tr>
                    <td><fmt:message key="currencies" /></td>
                    <td><fmt:formatNumber type="currency" value="654321" /></td>
                </tr>
                <tr>
                    <td><fmt:message key="percentage" /> </td>
                    <td><fmt:formatNumber type="percent" value="999999" /></td>
                </tr>
            </table>
        </form>
    </body>
</html>